package model

import (
	"encoding/json"
	"time"
)

// 收支明细表
type IncomeExpenditureDetails struct {
	ID                    int64     `json:"id" gorm:"id"`
	Date                  time.Time `json:"date" gorm:"date"`
	Type                  string    `json:"type" gorm:"type"`
	Path                  string    `json:"path" gorm:"path"`
	Income                float64   `json:"income" gorm:"income"`
	Expenditure           float64   `json:"expenditure" gorm:"expenditure"`
	Balance               float64   `json:"balance" gorm:"balance"`
	Remark                string    `json:"remark" gorm:"remark"`
	AdditionalDescription string    `json:"additionalDescription" gorm:"additional_description"`
	CreateTime            time.Time `json:"createTime" gorm:"create_time"`
	UpdateTime            time.Time `json:"updateTime" gorm:"update_time"`
}

func (ied *IncomeExpenditureDetails) TableName() string {
	return "ams-income_expenditure_details"
}

func (ied *IncomeExpenditureDetails) String() string {
	if dataInBytes, err := json.Marshal(&ied); err == nil {
		return string(dataInBytes)
	}

	return ""
}
